<%@ page import="foo.bar.blog.core.domain.User" %>
<%@ page import="foo.bar.blog.core.domain.Role" %>
<%@include file="/WEB-INF/pages/commons/commons.jsp"%>

<c:set var="tab" value="RecentEntries" scope="request"/>
<stripes:layout-render name="/baseMainLayout.jsp" _title="Main" _mainTitle="Recent Entries" _subTitle="Weblog Directory">

    <stripes:layout-component name="_head">${_head}</stripes:layout-component>
    <stripes:layout-component name="_leftHandSideGlobalMenu">${_leftHandSideGlobalMenu}</stripes:layout-component>
    <stripes:layout-component name="_searchInGlobalMenu">
        <stripes:form beanclass="foo.bar.blog.web.action.general.MainActionBean">
                <stripes:text name="searchEntryCriteria"/>
                <stripes:submit name="searchEntries">Search Entries</stripes:submit>
        </stripes:form>
    </stripes:layout-component>
    <stripes:layout-component name="_rightHandSideGlobalMenu">${_rightHandSideGlobalMenu}</stripes:layout-component>
    <stripes:layout-component name="_siteLogo">${_siteLogo}</stripes:layout-component>
    <stripes:layout-component name="_sideBox">${_sideBox}</stripes:layout-component>
    <stripes:layout-component name="_footer">${_footer}</stripes:layout-component>


    <stripes:layout-component name="_content">
        <jsecurity:hasPermission name="mainPortal:viewRecentEntries:*">
        <div id="recentEntries">
        <c:forEach items="${actionBean.searchEntriesResult.list}" var="currentEntry" varStatus="status">
        <div class="entry">
            <stripes:link beanclass="foo.bar.blog.web.action.general.BlogActionBean" event="viewEntry" class="entryTitle">
                <stripes:param name="entry" value="${currentEntry.id}"/>
                <c:out value="${currentEntry.name}"/>
            </stripes:link>
            <br/>
            <p class="entryDetails">
                <c:if test="${not empty currentEntry.creator}">
                    creator: <stripes:link beanclass="foo.bar.blog.web.action.general.BlogActionBean" event="view" class="entryTitle">
                    <stripes:param name="blog" value="${currentEntry.blog.id}" />
                    <c:out value="${currentEntry.creator.username}"/>
                </stripes:link>
                </c:if>
                <c:if test="${not empty currentEntry.creationDate}">
                    | creation date: ${currentEntry.creationDate}
                </c:if>
                <c:if test="${not empty currentEntry.modifier}">
                    | modifier: ${currentEntry.modifier.username}
                </c:if>
                <c:if test="${not empty currentEntry.modificationDate}">
                    | modification date: ${currentEntry.modificationDate}
                </c:if>

            </p>
            <p class="entryDescription">
                <c:out value="${currentEntry.description}"/>
            </p>
        </div>
        </c:forEach>
        </div>


        <!-- paging -->
        <hr/>
        <div>
            <c:if test="${actionBean.searchEntriesResult.anyPreviousPage}">
                <stripes:link beanclass="foo.bar.blog.web.action.general.MainActionBean" event="searchEntries">
                    <stripes:param name="pageNumber" value="${actionBean.searchEntriesResult.pageNumber - 1}"/>
                    Previous
                </stripes:link>
            </c:if>
            <c:if test="${actionBean.searchEntriesResult.anyNextPage}">
                <stripes:link beanclass="foo.bar.blog.web.action.general.MainActionBean" event="searchEntries">
                    <stripes:param name="pageNumber" value="${actionBean.searchEntriesResult.pageNumber + 1}"/>
                    Next
                </stripes:link>
            </c:if>
        </div>

        </jsecurity:hasPermission>
        <jsecurity:lacksPermission name="mainPortal:viewRecentEntries:*">
        No "mainPortal:viewRecentEntries:*" permission
        </jsecurity:lacksPermission>
    </stripes:layout-component>


    <stripes:layout-component name="_contentFooter">
        <!--
        <a href='http://www.jroller.com/frontpage/feed/entries/rss' title='Combined RSS feed for site.'>
            <img src='http://www.jroller.com/images/rssbadge.gif' border="0" alt='Combined RSS feed for site.' />
            </a>
            Right-click, copy link and paste into your newsfeed reader
        -->
        <!-- RSS feed comming soon -->
    </stripes:layout-component>


</stripes:layout-render>

